<%@ page language="java"  pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%>

<div class="com_pd_s1">
	<div class="box_s2">
		<div class="title">
			<a href="javascript:;" onclick="addSchedule('${schedule.id}');" class="def_btn_s1 btn">新建</a>
			<img src="images/other/icon_19.jpg" /><span>日程管理</span>
		</div>
		<div class="form_list schedule sche_manage">
			<ul class="data_head">
				<li class="schedule_time">时间</li><li class="info">内容</li><li class="data_ope">操作</li>
			</ul>
			<ul class="form_data">
			
				<s:iterator id="schedule" value="scheduleList.list" status="status">
           		 <li>
                    <div class="schedule_time"><img src="images/other/flag_1.jpg" /><span><s:date name="startTime" format="yyyy-MM-dd HH:mm:ss" /></span></div>
                    <p class="info"><a href="javascript:;" onclick="showDetail('<s:property value="id"/>')"><s:property value="title"/></a></p>
                    <div class="data_ope">
						<a href="javascript:;" onclick="editSchedule('<s:property value="id"/>');">修改</a><a href="javascript:;" onclick="deleteSchedule('<s:property value="id"/>');">删除</a>
					</div>
                </li>
              		
              	</s:iterator>
			</ul>
		</div>
	</div>
	
	 <div id="fy_container"></div>
	
</div>

<script type="text/javascript">

	$(function(){
		
		$.defUnit.pager({
				curPage:<s:property value="scheduleList.currentPage"/>,
				totalPage:<s:property value="scheduleList.totalPage"/>,
				customStyle:"customStyle",
				containerID:"fy_container",
				afterClickPage:function(page){
					window.location.href="schedule!view.do?page="+page;
				}		
			}
		)
	})
	function editSchedule(id){
		$("#schedule_list").load("schedule!edit.do?id="+id);
	}
	
	function addSchedule(id){
		$("#schedule_list").load("schedule!add.do?id="+id);
	}
	
	function deleteSchedule(id){
		if(confirm("你真的要删除日程吗？")){
			$.post("schedule!delete.do",{
				id:id
			},function(data){
				var ret = $.parseJSON(data);
				if(ret.success == 'true'){
					$("#schedule_list").load("schedule!manage.do?day=${day}");
				}else{
					alert(ret.msg);
				}
			});
		}
	}
</script>